package com.uinnova.product.eam.mvc;

import com.binary.framework.bean.annotation.Comment;
import com.binary.framework.web.RemoteResult;
import com.uinnova.product.eam.dto.SimpOrgInfo;
import com.uinnova.product.eam.service.ArchReviewOrgConfService;
import com.uinnova.product.eam.vo.ArchReviewOrgConfInfo;
import com.uinnova.product.eam.vo.ArchReviewOrgConfSaveReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Comment("架构评审团队配置")
@RequestMapping("/arch/review/org/conf")
public class ArchReviewOrgConfController {

    @Autowired
    private ArchReviewOrgConfService orgConfService;

    @PostMapping("/save")
    public RemoteResult save(@RequestBody List<ArchReviewOrgConfSaveReq> reqs) {
        orgConfService.save(reqs);
        return new RemoteResult("success");
    }

    @GetMapping("/info")
    public RemoteResult info() {
        List<ArchReviewOrgConfInfo> infos = orgConfService.info();
        return new RemoteResult(infos);
    }

    @GetMapping("/orgs")
    public RemoteResult orgs() {
        List<SimpOrgInfo> orgInfos = orgConfService.orgs();
        return new RemoteResult(orgInfos);
    }
}
